package com.example.thread.b2thread2;

/**
 * 实现runnable接口
 */
public class MyRunnable{
    public static void main(String[] args) {
        // 创建任务对象
        MyRunnableTest m1 = new MyRunnableTest();
        // 把任务对象交给一个线程对象处理
        new Thread(m1).start();
        // 主线程
        for (int i = 0; i < 10; i++) {
            System.out.println("主线程"+i);
        }
    }
}
class MyRunnableTest implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println("MyRunnable输出"+i);
        }
    }
}
